package cn.learn.hystrix.controller;

import cn.learn.hystrix.service.HystrixService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author huangyezhan
 * @version 1.0
 * @date 2020年11月28日8:17
 */
@RestController
public class HystrixController {

    @Resource
    private HystrixService hystrixService;

    @RequestMapping(value = "ok", method = RequestMethod.GET)
    public String hystrixOk(@RequestParam("id") Integer id) {
        return hystrixService.hystrixOk(id);
    }

    @RequestMapping(value = "timeout/{id}", method = RequestMethod.GET)
    public String hystrixTimeOut(@PathVariable("id") Integer id) {
        return hystrixService.hystrixTimeOut(id);
    }


    @RequestMapping(value = "global/{id}", method = RequestMethod.GET)
    public String hystrixGlobal(@PathVariable("id") Integer id) {
        return hystrixService.hystrixGlobal(id);
    }

}
